//
//  ViewController.m
//  VibratingView
//
//  Created by apple on 2017/9/19.
//  Copyright © 2017年 NetEaseExam. All rights reserved.
//

#import "ViewController.h"

#import "KLPlayingView.h"
#import "RLPlayingView.h"

@interface ViewController (){
    KLPlayingView *_playingView;
    RLPlayingView *_rlPlayingView;
}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor redColor];
    [self testPlayingView];
    [self testRLPlayingView];
}

- (void)testPlayingView{
    _playingView = [[KLPlayingView alloc] init];
    _playingView.color = [UIColor whiteColor];
    _playingView.barWidth = 20.0f;
    _playingView.bounds = CGRectMake(0, 0, 200, 200);
    _playingView.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds) - 125);
    [self.view addSubview:_playingView];
}

- (void)testRLPlayingView{
    _rlPlayingView = [[RLPlayingView alloc] init];
    _rlPlayingView.color = [UIColor lightGrayColor];
    _rlPlayingView.bounds = CGRectMake(0, 0, 200, 200);
    _rlPlayingView.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds) + 125);
    [self.view addSubview:_rlPlayingView];
}


- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    if ([_playingView isAnimating])
    {
        [_playingView stopAnimating];
    }
    else
    {
        [_playingView startAnimating];
    }
    
    if ([_rlPlayingView isAnimating])
    {
        [_rlPlayingView stopAnimating];
    }
    else
    {
        [_rlPlayingView startAnimating];
    }
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
